<?php
class BaseController extends Controller{
	
	public function isLogin(){
		return isset($_SESSION['user']);
	}
	
	public function getLoginUser(){
		if(isset($_SESSION['user'])){
			return $_SESSION['user'];
		}else {
			return null;
		}
	}
	
	public function redirectLogin(){
		echo "<script language='javascript' type='text/javascript'>";
		echo "window.location.href='".WEBSITE_URL."login'";
		echo "</script>";
		exit(0);
	}
	
	public function redirectHome(){
		echo "<script language='javascript' type='text/javascript'>";
		echo "window.location.href='".WEBSITE_URL."'";
		echo "</script>";
		exit(0);
	}
}
?>